// pages/addCard/addCard.js

var app = getApp();
var page=1;
var selectedNews = false;
var newsList = [];

Page({
  data:{
    phone: '',
    name: '',
    bankCard: '',
    idCard: ''
  },
  inputgetName: function (e) {
    this.setData({
      name: e.detail.value
    });
  },
  inputgetPhone: function (e) {
    this.setData({
      phone: e.detail.value
    });
  },
  inputgetIdCard: function (e) {
    this.setData({
      idCard: e.detail.value
    });
  },
  inputgetBankCard: function (e) {
    this.setData({
      bankCard: e.detail.value
    });
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
  },
  //点击完成新增银行卡
  bindSaveTap: function (e) {
    var url = '/wallet_api/addBankCard';
    var params = {
      uid: app.globalData.userInfo.id,
      phone: this.data.phone,
      name: this.data.name,
      person_id: this.data.idCard,
      card_number: this.data.bankCard
    };
    app.HttpPostSend(url, params, function (res) {
      if (res.code == "-1") {
        app.showTipMsg(res.data);
      } else {
        app.showTipMsg('新增银行卡成功');
        wx.navigateBack({
          url: '../myBankCard/myBankCard',
        })
      }
    });
  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示

  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  },
  // onShareAppMessage: function () {
    
  // },
  /** 
   * 页面上拉触底事件的处理函数 
   */
  onReachBottom: function () {
    
  }
})